#!/bin/bash

Compiler="arm-rockchip830-linux-uclibcgnueabihf"

rm openssl-1.0.2u -rf
tar -xvzf openssl-1.0.2u.tar.gz
cd openssl-1.0.2u
./config  no-asm shared --prefix=$PWD/_install --cross-compile-prefix=$Compiler-
sed -i 's/\s*-m64\b//g' Makefile
make CC=$Compiler-gcc -j4
make install
cd ..


rm libnl-3.11.0 -rf
tar -xvzf libnl-3.11.0.tar.gz
cd libnl-3.11.0
./configure --host=$Compiler --prefix=$PWD/_install
make -j4 && make install
cd ..

mkdir pkgconfig
cp openssl-1.0.2u/_install/lib/pkgconfig/* pkgconfig/
cp libnl-3.11.0/_install/lib/pkgconfig/* pkgconfig/
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PWD/pkgconfig

rm wpa_supplicant-2.10 -rf
tar -xzf wpa_supplicant-2.10.tar.gz
cd wpa_supplicant-2.10/wpa_supplicant
cp ../../user.config .config
make CC=$Compiler-gcc -j4